home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / modula-3 / src-m3-3.000 / src-m3-3 / usr / local / soft / modula3-3.4 / bin / m3zume < prev    next >
Encoding:
Text File  |  1995-01-30  |  6.0 KB  |  178 lines

  1. #! /bin/csh -f
  2. #   DIGITAL EQUIPMENT CORPORATION  CONFIDENTIAL AND PROPRIETARY
  3. #   Last modified on Sun Jun  5 16:17:39 PDT 1994 by mhb    
  4. #        modified on Fri Jun  3 10:13:04 PDT 1994 by heydon 
  5. #        modified on Mon Jan 24 13:16:06 PST 1994 by najork 
  6. #        modified on Wed Jul 15 16:32:45 PDT 1992 by johnh
  7. #        modified on Fri May 22 17:00:20 PDT 1992 by muller
  8. #        modified on Fri Dec 30 10:52:31 PST 1988 by brooks
  9.  
  10.  
  11. #set DIR="."            # for testing
  12. #set DIR="/-/com/dec/src/udir/johnh/m3packages/m3zume/src"   # for testing
  13. set DIR="/udir/mhb/m3/m3zume/src"
  14. set DIR=/usr/local/soft/modula3-3.4/lib/m3/LINUX
  15.  
  16. # The -GEF flag is no longer supported.
  17. if ( xxx$1 == xxx-GEF ) then 
  18.   echo 'The -GEF option is no longer supported; try "man m3zume"'
  19.   exit 1
  20. endif
  21.  
  22. # If the first arg is "-testdir", then the second arg is the directory
  23. # that contains the template files.
  24. if ( xxx$1 == xxx-testdir ) then
  25.   shift
  26.   set DIR=$1
  27.   shift
  28. endif
  29.  
  30. set me="m3zume"
  31. set mode = ""
  32. set base = ""
  33. if ( xxx$1 == xxx-3D ) then 
  34.   set mode=`echo $1 | sed s/-//`
  35.   set me=m3zume:${mode}
  36.   shift
  37. else if ( xxx$1 == xxx-Juno ) then
  38.   set mode=`echo $1 | sed s/-//`
  39.   set me=m3zume:${mode}
  40.   shift
  41.   set base=$1
  42.   shift
  43. else if ( ( xxx$1 == xxx-Obliq ) || ( xxx$1 == xxx-Obliq3D ) ) then 
  44.   set mode=`echo $1 | sed s/-//`
  45.   set me=m3zume:${mode}
  46.   shift
  47.   set file=$1
  48.   set base=`basename $1`
  49.   shift
  50. endif
  51.  
  52. # Now the first arg is the name of the algorithm file.
  53. set algfile=$1
  54. set alg=`basename $1`
  55.  
  56. if ($mode == "") then
  57. set WORK=(algtem.i3 ${alg}AlgClass.i3 .i3 \
  58.           algtem.m3 ${alg}AlgClass.m3 .m3 \
  59.           viewtem.i3 ${alg}ViewClass.i3 .i3 \
  60.           viewtem.m3 ${alg}ViewClass.m3 .m3 \
  61.           ietem.i3 ${alg}IE.i3 .i3 \
  62.           ietem.m3 ${alg}IE.m3 .m3 \
  63.           datatem.i3 ${alg}DataView.i3 .i3 \
  64.           datatem.m3 ${alg}DataView.m3 .m3 \
  65.           transtem.i3 ${alg}TranscriptView.i3 .i3 \
  66.           transtem.m3 ${alg}TranscriptView.m3 .m3 \
  67.           transtem.fv ${alg}TranscriptView.fv .fv \
  68.           edtem.fv ${alg}EventData.fv .fv) 
  69. else if ($mode == "3D") then
  70. set WORK=(algtem.i3 ${alg}AlgClass.i3 .i3 \
  71.           algtem.m3 ${alg}AlgClass.m3 .m3 \
  72.           viewtem.i3 ${alg}ViewClass.i3 .i3 \
  73.           viewtem.m3 ${alg}ViewClass.m3 .m3 \
  74.           view3Dtem.i3 ${alg}3DViewClass.i3 .i3 \
  75.           view3Dtem.m3 ${alg}3DViewClass.m3 .m3 \
  76.           ie3Dtem.i3 ${alg}IE.i3 .i3 \
  77.           ie3Dtem.m3 ${alg}IE.m3 .m3 \
  78.           datatem.i3 ${alg}DataView.i3 .i3 \
  79.           datatem.m3 ${alg}DataView.m3 .m3 \
  80.           transtem.i3 ${alg}TranscriptView.i3 .i3 \
  81.           transtem.m3 ${alg}TranscriptView.m3 .m3 \
  82.           transtem.fv ${alg}TranscriptView.fv .fv \
  83.           edtem.fv ${alg}EventData.fv .fv) 
  84. else
  85. echo "mode is ${mode}"
  86. set WORK=(${mode}tem.i3 `basename ${alg} .evt`${base}${mode}View.i3 .i3 \
  87.           ${mode}tem.m3 `basename ${alg} .evt`${base}${mode}View.m3 .m3)
  88. endif 
  89.  
  90. if (! -f $algfile.evt) then
  91.   echo "${me} cannot find file $algfile.evt."
  92.   exit 1
  93. endif
  94.  
  95. echo "${me} processing file $algfile.evt..."
  96.     # strip off the imports, put one per line:
  97. awk -f $DIR/algimport.awk $algfile.evt \
  98.         | awk -f $DIR/uncomm.awk \
  99.         | sed -f $DIR/fixspaces.sed  \
  100.         | awk -f $DIR/importlist.awk \
  101.         | sort -u  > zume$$.evtimport
  102.     # strip off the algorithm data:
  103. awk -f $DIR/algdata.awk $algfile.evt > zume$$.algdata
  104.     # uncomment, regularize spacing, put one proc per line
  105. awk -f $DIR/uncomm.awk $algfile.evt \
  106.         | sed -f $DIR/fixspaces.sed  \
  107.     | awk -f $DIR/fmtlines.awk > zume$$.events
  108.  
  109. while ($#WORK > 0)
  110.   echo "${me} creating $WORK[2]..."
  111.   sed -e "/^IMPORT/\!d" \
  112.       -e "s/#(_ALGNAME_)/$alg/g" \
  113.       -e "s/#(_VIEWNAME_)/$base/g" \
  114.       $DIR/$WORK[1] \
  115.         | sed -f $DIR/fixspaces.sed  \
  116.         | awk -f $DIR/importlist.awk \
  117.         | sort -u \
  118.         | comm -23 zume$$.evtimport - > zume$$.import
  119.   echo '#(_TRANSFORM_)' \
  120.         | cat zume$$.events - $DIR/$WORK[1] \
  121.         | sed -e "s/#(_ALGNAME_)/$alg/g" \
  122.               -e "s/#(_VIEWNAME_)/$base/g" \
  123.               -e "/#(_IMPORTS_)/r zume$$.import" \
  124.           -e "/#(_IMPORTS_)/d" \
  125.               -e "/#(_ALGDATA_)/r zume$$.algdata" \
  126.           -e "/#(_ALGDATA_)/d" \
  127.     | awk -f $DIR/transform.awk > zume$$.tmp
  128.   switch ($WORK[3])
  129.     case .i3:
  130.     case .m3:
  131.       cat zume$$.tmp > $WORK[2]
  132.       breaksw
  133.     case .fv:
  134.       cat zume$$.tmp > $WORK[2]
  135.       breaksw
  136.     default:
  137.       echo "Unknown file type $WORK[3]"; exit 1
  138.       breaksw
  139.     endsw
  140.   shift WORK; shift WORK; shift WORK
  141. end
  142. echo "${me} finished."
  143.  
  144. /bin/rm zume$$.events zume$$.evtimport zume$$.import zume$$.algdata zume$$.tmp
  145.  
  146. exit 0
  147.  
  148. #{             start repeated block; must be alone at head of line
  149. #{_OUTPUT        start repeated block of output events only
  150. #{_FEEDBACK        start repeated block of feedback events only
  151. #}            end repeated block; must be alone at head of line
  152. #|                      introduces between-args material; must be alone
  153.                         # at head of line and inside a per-arg block
  154. #(_ALGNAME_)        algorithm name
  155. #(_VIEWNAME_)        view name (for -Obliq or -Obliq3D)
  156. #(_IMPORTS_)        import statements go here
  157. #(_ALGDATA_)        data fields for algorithm object
  158. #(_TRANSFORM_)        boundary between parsing and transforming
  159. #(_EVENT_)        name of event
  160. #(_EVENTSTYLE_)        "OutputEvent", "FeedbackEvent", or "UpdateEvent",
  161.             # as apropos
  162. #(_EVENTPRIO_)        Integer priority, in 1..9
  163. #(_ARGSTR_)        unprocessed arg string, with no trailing semis
  164. #(_NONULL_ARGSTR_)    ... w/ a dummy integer declaration if null
  165. #(_SEMI_ARGSTR_)    ... w/ leading semi if non-null
  166. #(_ARGSTR_SEMI_)        ... w/ trailing semi if non-null
  167. #(_ARGTYPES_)        types of args, no names
  168. #(_COMMA_ARGTYPES_)    ... w/ leading comma
  169. #(_SPACED_ARGTYPES_)    types of args, with spaces, not commas, between
  170. #(_ARGNAMES_)        names of args, no types, as for a call
  171. #(_COMMA_ARGNAMES_)    ... w/ leading comma
  172. #(_TYPE_FORMATS_)    fmt string to pass to PRINTF to print args
  173. #(_PRINTF_ARGS_)    argument string to pass to PRINTF to print args
  174. #(_ARGNAME_)        single argument name
  175. #(_ARGTYPE_)        single argument type
  176. #(_ARGFMT_)        a function that gives a printable text when
  177.                         # applied to the argument
  178.